/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GUI;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author David
 */
public class Monitor {
    
    private boolean b;
    public Monitor()
    {
        b=true;
    }
    
    public synchronized void  get()
    {
        try {
            if (b) {
                wait();
            }
            b=true;
        } catch (InterruptedException ex) {
            Logger.getLogger(Monitor.class.getName()).log(Level.SEVERE, null, ex);
        }
            
    }
    
    public synchronized void put()
    {
            b=true;
            notify();
            
    }

}
